# -*- coding: utf-8 -*-
import os
from app.configs import global_config, root_path, sys_type,real_root_path
from tornado.web import StaticFileHandler

from app.views.views_init import InitHandler
from app.views.views_vector import VectorsHandler
from app.views.views_dxf import DxfHandler
from app.views.views_dwg import DwgHandler
from app.views.views_mine import MineHandler
from app.views.views_track import TrackHandler
from app.views.views_position import PositionHandler
from app.views.views_person import PersonHandler
from app.views.views_vehicle import VehicleHandler
from app.views.views_code import CodeHandler, ConfigHandler
from app.views.views_meta import MetaHandler
from app.views.views_metas import MetasHandler
from app.views.views_warning import WarningHandler
from app.views.views_monitor import MonitorHandler
from app.views.views_reader import ReaderHandler
from app.views.views_car import CarHandler, CarTrackHandler
from app.views.views_sensor import SensorHandler
from app.views.views_zTree_Admin import zTreeAdminHandler
from app.views.views_zTree_data import zTreeDataHandler
from app.views.views_smposition import SmPositionHandler
from app.views.views_smInfo import SmInfoHandler
from app.views.views_gas_integration import integrationHandler
from app.views.views_ventilation import ventilationHandler
from app.views.views_ventination_rotation import Ventination_Rotation_Handler
from app.views.views_sm_poweredArea import Powered_Area_Handler
from app.views.views_layer_feature import Layer_Feature_Handler
from app.views.views_layer_color import Layer_color_Handler

# 静态变量地址
static_path = os.path.join(real_root_path,"app","static")

# 路由视图映射：(路由地址,视图)
urls = [
    (r'/init', InitHandler),
    (r'/meta', MetaHandler),
    (r'/metas', MetasHandler),
    (r'/code', CodeHandler),
    (r'/config', ConfigHandler),
    (r'/vector', VectorsHandler),
    (r'/dxf', DxfHandler),
    (r'/dwg', DwgHandler),
    (r'/mine', MineHandler),
    (r'/track', TrackHandler),
    (r'/position', PositionHandler),
    (r'/vehicle', VehicleHandler),
    (r'/person', PersonHandler),
    (r'/warning', WarningHandler),
    (r'/monitor', MonitorHandler),
    (r'/sensor', SensorHandler),
    (r'/reader', ReaderHandler),
    (r'/car', CarHandler),
    (r'/cartrack', CarTrackHandler),
    (r'/zTreeAdmin', zTreeAdminHandler),
    (r'/zTreeData', zTreeDataHandler),
    (r'/sm_position', SmPositionHandler),
    (r'/sm_info', SmInfoHandler),
    (r'/integration', integrationHandler),
    (r'/ventilation', ventilationHandler),
    (r'/ventilation_rotation', Ventination_Rotation_Handler),
    (r'/sm_powered_area', Powered_Area_Handler),
    (r'/layer_feature', Layer_Feature_Handler),
    (r'/layer_color', Layer_color_Handler),
    (r'/(.*)$', StaticFileHandler, {
        'path': static_path,
        'default_filename': '''%s.html''' % global_config['name']
    })
]
